package com.xiaoshuidi.cloud.module.rooms.api.home;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.module.rooms.api.home.vo.*;
import com.xiaoshuidi.cloud.module.rooms.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.security.PermitAll;
import java.util.List;

@FeignClient(name = ApiConstants.SERVERNAME)
public interface HomeApi {
    String PREFIX = ApiConstants.PREFIX + "/home";

    @Operation(summary = "集中式-搜索找房")
    @Parameters({
            @Parameter(name = "searchBox", description = "搜索框查询"),
            @Parameter(name = "district", description = "区域"),
            @Parameter(name = "monthRentalMin", description = "租金范围-下限"),
            @Parameter(name = "monthRentalMax", description = "租金范围-上限"),
            @Parameter(name = "longitude", description = "地铁站经度"),
            @Parameter(name = "latitude", description = "地铁站纬度"),
            @Parameter(name = "sortRule", description = "排序规则 1:推荐排序 2:最新发布 3:价格升序 4:价格降序 5:面积升序 6:面积降序"),
            @Parameter(name = "isWhole", description = "出租方式,是否整租 true:整租 false:合租"),
            @Parameter(name = "bedRoomNum", description = "户型-几室 1:一室 2:二室 3:三室 4:四室 5:其他"),
            @Parameter(name = "publicFacilities", description = "特色需求(公共设施)", example = "独立卫生间"),
            @Parameter(name = "lon", description = "用户所在经度"),
            @Parameter(name = "lat", description = "用户所在纬度"),
    })
    @GetMapping(PREFIX + "/concentrated-find-house")
    public CommonResult<PageResult<ConcentratedFindHouseRespApiVO>> concentratedFindHouse(@RequestParam(value = "searchBox", required = false) String searchBox,
                                                                                          @RequestParam(value = "district", required = false) String district,
                                                                                          @RequestParam(value = "monthRentalMin", required = false) Double monthRentalMin,
                                                                                          @RequestParam(value = "monthRentalMax", required = false) Double monthRentalMax,
                                                                                          @RequestParam(value = "longitude",required = false) Double longitude,
                                                                                          @RequestParam(value = "latitude",required = false) Double latitude,
                                                                                          @RequestParam(value = "sortRule",required = false) Integer sortRule,
                                                                                          @RequestParam(value = "isWhole",required = false) Boolean isWhole,
                                                                                          @RequestParam(value = "bedRoomNum",required = false) Integer bedRoomNum,
                                                                                          @RequestParam(value = "publicFacilities",required = false) String publicFacilities,
                                                                                          @RequestParam(value = "lon",required = false) String lon,
                                                                                          @RequestParam(value = "lat",required = false) String lat,
                                                                                          @RequestParam("pageNum") Integer pageNum,
                                                                                          @RequestParam("pageSize") Integer pageSize);

    @Operation(summary = "分散式-搜索找房")
    @Parameters({
            @Parameter(name = "searchBox", description = "搜索框查询"),
            @Parameter(name = "district", description = "区域"),
            @Parameter(name = "monthRentalMin", description = "租金范围-下限"),
            @Parameter(name = "monthRentalMax", description = "租金范围-上限"),
            @Parameter(name = "longitude", description = "地铁站经度"),
            @Parameter(name = "latitude", description = "地铁站纬度"),
            @Parameter(name = "sortRule", description = "排序规则 1:推荐排序 2:最新发布 3:价格升序 4:价格降序 5:面积升序 6:面积降序"),
            @Parameter(name = "isWhole", description = "出租方式,是否整租 true:整租 false:合租"),
            @Parameter(name = "bedRoomNum", description = "户型-几室 1:一室 2:二室 3:三室 4:四室 5:其他"),
            @Parameter(name = "publicFacilities", description = "特色需求(公共设施)", example = "独立卫生间"),
    })
    @GetMapping(PREFIX + "/no-concentrated-find-house")
    public CommonResult<PageResult<NoConcentratedFindHouseRespApiVO>> noConcentratedFindHouse(@RequestParam(value = "searchBox",required = false) String searchBox,
                                                                                              @RequestParam(value = "district",required = false) String district,
                                                                                              @RequestParam(value = "monthRentalMin",required = false) Double monthRentalMin,
                                                                                              @RequestParam(value = "monthRentalMax",required = false) Double monthRentalMax,
                                                                                              @RequestParam(value = "longitude",required = false) Double longitude,
                                                                                              @RequestParam(value = "latitude",required = false) Double latitude,
                                                                                              @RequestParam(value = "sortRule",required = false) Integer sortRule,
                                                                                              @RequestParam(value = "isWhole",required = false) Boolean isWhole,
                                                                                              @RequestParam(value = "bedRoomNum",required = false) Integer bedRoomNum,
                                                                                              @RequestParam(value = "publicFacilities",required = false) String publicFacilities,
                                                                                              @RequestParam(value = "roomAreaId",required = false) Long roomAreaId,
                                                                                              @RequestParam("pageNum") Integer pageNum,
                                                                                              @RequestParam("pageSize") Integer pageSize);

    @Operation(summary = "社区-门店详情")
    @Parameter(name = "apartmentId", description = "门店id")
    @GetMapping(PREFIX + "/get-apartment-info")
    public CommonResult<ApartmentInfoRespApiVO> getApartmentInfo(@RequestParam("apartmentId") Long apartmentId);


    @Operation(summary = "社区-房源详情")
    @Parameters({
            @Parameter(name = "roomHouseId", description = "房源id"),
    })
    @GetMapping(PREFIX + "/get-room-house-info")
    public CommonResult<RoomHouseInfoRespApiVO> getRoomHouseInfo(@RequestParam("roomHouseId") Long roomHouseId);

    @Operation(summary = "社区-房源详情-同房源其他房间")
    @Parameters({
            @Parameter(name = "roomHouseId", description = "房源id"),
    })
    @GetMapping(PREFIX + "/other-rooms-in-the-same-listing")
    public CommonResult<List<OtherRoomsInTheSameListingRespApiVO>> otherRoomsInTheSameListing(@RequestParam("roomHouseId") Long roomHouseId, @RequestParam("tenantId") Long tenantId);

    @Operation(summary = "社区-房源详情-推荐附近房源")
    @Parameters({
            @Parameter(name = "roomHouseId", description = "房源id"),
    })
    @GetMapping(PREFIX + "/recommend-listings-near-you")
    public CommonResult<List<OtherRoomsInTheSameListingRespApiVO>> recommendListingsNearYou(@RequestParam("roomHouseId") Long roomHouseId, @RequestParam("tenantId") Long tenantId);

    @Operation(summary = "社区-房型详情")
    @Parameters({
            @Parameter(name = "apartmentId", description = "门店id"),
            @Parameter(name = "layoutId", description = "房型id")
    })
    @GetMapping(PREFIX + "/get-layout-info")
    public CommonResult<GetLayoutInfoRespApiVO> getLayoutInfo(@RequestParam("apartmentId") Long apartmentId, @RequestParam("layoutId") Long layoutId);

    /**
     * 查询房源房型
     * @return
     */
    @GetMapping("/queryRoomLayout")
    CommonResult<List<RoomLayoutVO>> queryRoomLayout();
}
